<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Contact extends CI_Controller {
    
   public function index(){
    $this->load->model('Configs', '', true);
    $this->load->model('Contacts', '', true);     
    if($this->input->post()){
       if($this->Contacts->insert($this->input->post())){
            $this->session->set_flashdata('message', 'Bạn đã gửi thành công.');
            redirect('/contact');
       } 
    }
    $data['Config'] = $this->Configs->getList(); 
    
    $this->load->view('contact/index', $data);
    
   }
}